<?php
class Configs extends MY_Controller{
	//前置过滤
	var $beforeFilter = array(
			'initAdmin' => array(
				'only' => array('admin','save'),
			),
			'_init' => array(
				'only' => array('index'),
			),
		);

	function Configs()
	{
		parent::MY_Controller();
		$this->load->model('Config');
	}

	function index(){
		$this->admin();
	}
	
	function admin()
	{	
		$rs = $this->Config->doList();
		$this->assign['result'] = $rs;
		$this->display();
	}

	function save(){
		$redirect = $this->getRedirect('/index.php/configs/admin');
		if($this->Config->save($_POST['id'])){
			$this->showMessage('mes_success',$redirect);
		}else{
			$this->showMessage($this->Config->_error); 
		}
	}
}